package xyz.kail.demo.consul.api.session;

import com.ecwid.consul.v1.ConsulRawClient;
import com.ecwid.consul.v1.Response;
import com.ecwid.consul.v1.session.SessionConsulClient;
import com.ecwid.consul.v1.session.model.NewSession;
import xyz.kail.demo.consul.api.R;

/**
 * Created by kail on 2018/1/21.
 */
public class ConsulSessionMain {

    public static void main(String[] args) {
        ConsulRawClient consulRawClient = new ConsulRawClient(R.IP, R.PORT);
        SessionConsulClient sessionConsulClient = new SessionConsulClient(consulRawClient);

        NewSession newSession = new NewSession();
        newSession.setName("test-session");
        newSession.setNode("924fe581ca07");

        Response<String> sessionCreate = sessionConsulClient.sessionCreate(newSession, null);
        System.out.println(sessionCreate.toString());
    }

}
